<?php

namespace app\modules\api\controllers;

use yii\rest\ActiveController;

/**
 * @OA\Tag(
 *      name="Group",
 *      description="组织管理"
 * )
 */
class GroupController extends ActiveController
{
    public $modelClass = 'app\modules\api\models\Group';

    /**
     * @OA\Get(
     *      path="/group",
     *      summary="组织 - 首页展示（ 左右为组织+部门、右侧为岗位 ）",
     *      tags={"Group"},
     *      @OA\Response(
     *          response=200,
     *          description="Ok",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="deptType",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="普通部门", description="名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="Id"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="position",
     *                      type="array",
     *                      @OA\Items(
     *                          type="object",
     *                          @OA\Property(property="id", type="integer", example=1, description="岗位ID"),
     *                          @OA\Property(property="parentId", type="integer", example=0, description="岗位上级ID"),
     *                          @OA\Property(property="name", type="string", example="经理", description="岗位名称"),
     *                          @OA\Property(property="count", type="integer", example=1, description="岗位下的人数统计"),
     *                          @OA\Property(
     *                              property="children",
     *                              type="array",
     *                              @OA\Items(
     *                                  type="object",
     *                                  @OA\Property(property="id", type="integer", example=2, description="岗位ID"),
     *                                  @OA\Property(property="parentId", type="integer", example=1, description="岗位上级ID"),
     *                                  @OA\Property(property="name", type="string", example="组员", description="岗位名称"),
     *                                  @OA\Property(property="count", type="integer", example=3, description="岗位下的人数统计"),
     *                              )
     *                          )
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="group",
     *                      type="array",
     *                      @OA\Items(
     *                          type="object",
     *                          @OA\Property(property="id", type="integer", example=1, description="组织ID"),
     *                          @OA\Property(property="name", type="string", example="晟田集团", description="组织名称"),
     *                          @OA\Property(property="count", type="integer", example=2000, description="组织下的人数统计"),
     *                          @OA\Property(property="isGroup", type="boolean", example=1, description="表示是组织（ 1：是 0：不是）"),
     *                          @OA\Property(
     *                              property="children",
     *                              type="array",
     *                              @OA\Items(
     *                                  type="object",
     *                                  @OA\Property(property="id", type="integer", example=1, description="部门ID"),
     *                                  @OA\Property(property="parentId", type="integer", example=0, description="部门上级ID"),
     *                                  @OA\Property(property="name", type="string", example="IT部门", description="部门名称"),
     *                                  @OA\Property(property="count", type="integer", example=3, description="部门下的人数统计"),
     *                                  @OA\Property(
     *                                      property="children",
     *                                      type="array",
     *                                      @OA\Items(
     *                                          @OA\Property(property="id", type="integer", example=2, description="部门ID"),
     *                                          @OA\Property(property="parentId", type="integer", example=1, description="部门上级ID"),
     *                                          @OA\Property(property="name", type="string", example="技术开发部", description="部门名称"),
     *                                          @OA\Property(property="count", type="integer", example=3, description="部门下的人数统计"),
     *                                          @OA\Property(
     *                                             property="children",
     *                                             type="array",
     *                                             @OA\Items()
     *                                          )
     *                                      )
     *                                  )
     *                              )
     *                          )
     *                      )
     *                  ),
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionIndex()
    {
    }

    /**
     * @OA\Post(
     *      path="/group/create",
     *      tags={"Group"},
     *      summary="组织 - 添加 （ 接收表单提交 ）",
     *      @OA\RequestBody(
     *          @OA\MediaType(
     *              mediaType="multipart/form-data",
     *              @OA\Schema(
     *                  required={"name"},
     *                  @OA\Property(property="parentId", type="integer", description="父级ID", default="0"),
     *                  @OA\Property(property="name", type="string", description="组织名称"),
     *                  @OA\Property(property="sort", type="integer", description="排序值", default="0"),
     *             )
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionCreate()
    {
    }

    /**
     * @OA\Post(
     *      path="/group/update",
     *      tags={"Group"},
     *      summary="组织 - 编辑 （ 接收表单提交 ）",
     *      @OA\Parameter(
     *          name="id",
     *          in="query",
     *          description="组织ID",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *          ),
     *      ),
     *      @OA\RequestBody(
     *          @OA\MediaType(
     *              mediaType="multipart/form-data",
     *              @OA\Schema(
     *                  required={"name"},
     *                  @OA\Property(property="parentId", type="integer", description="父级ID", default="0"),
     *                  @OA\Property(property="name", type="string", description="组织名称"),
     *                  @OA\Property(property="sort", type="integer", description="排序值", default="0"),
     *              )
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionUpdate()
    {
    }

    /**
     * @OA\POST(
     *      path="/group/delete",
     *      summary="组织 - 删除 （ 接收表单提交 ）",
     *      tags={"Group"},
     *      @OA\Parameter(
     *          description="组织ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionDelete()
    {
    }

    /**
     * @OA\Get(
     *      path="/group/get-drop-list",
     *      summary="组织 - 拉列表 ( 添加、编辑 调用 )",
     *      tags={"Group"},
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="晟田集团", description="组织名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="组织ID"),
     *                      ),
     *                  ),
     *                  example={"name":"晟田集团", "id": 1}
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetDropList()
    {
    }

    /**
     * @OA\Get(
     *      path="/group/get-tree-list",
     *      summary="组织 & 部门 列表树 ( 用户首页调用 )",
     *      tags={"Group"},
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="group",
     *                      type="array",
     *                      @OA\Items(
     *                          type="object",
     *                          @OA\Property(property="id", type="integer", example=1, description="组织ID"),
     *                          @OA\Property(property="name", type="string", example="晟田集团", description="组织名称"),
     *                          @OA\Property(property="count", type="integer", example=2000, description="组织下的人数统计"),
     *                          @OA\Property(property="isGroup", type="boolean", example=1, description="表示是组织"),
     *                          @OA\Property(
     *                              property="children",
     *                              type="array",
     *                              @OA\Items(
     *                                  type="object",
     *                                  @OA\Property(property="id", type="integer", example=1, description="部门ID"),
     *                                  @OA\Property(property="parentId", type="integer", example=0, description="部门上级ID"),
     *                                  @OA\Property(property="name", type="string", example="IT部门", description="部门名称"),
     *                                  @OA\Property(property="count", type="integer", example=3, description="部门下的人数统计"),
     *                                  @OA\Property(
     *                                      property="children",
     *                                      type="array",
     *                                      @OA\Items(
     *                                          @OA\Property(property="id", type="integer", example=2, description="部门ID"),
     *                                          @OA\Property(property="parentId", type="integer", example=1, description="部门上级ID"),
     *                                          @OA\Property(property="name", type="string", example="技术开发部", description="部门名称"),
     *                                          @OA\Property(property="count", type="integer", example=3, description="部门下的人数统计"),
     *                                          @OA\Property(
     *                                             property="children",
     *                                             type="array",
     *                                             @OA\Items()
     *                                          )
     *                                      )
     *                                  )
     *                              )
     *                          )
     *                      )
     *                  )
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetTreeList()
    {

    }

    /**
     * @OA\Get(
     *      path="/group/get-info",
     *      tags={"Group"},
     *      summary="组织 - 编辑时的信息 （ 编辑时调用 ）",
     *      @OA\Parameter(
     *          name="id",
     *          in="query",
     *          description="组织ID",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *          ),
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="list",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="name", type="string", example="晟田集团", description="组织名称"),
     *                          @OA\Property(property="id", type="integer", example=1, description="组织ID"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="group",
     *                      type="object",
     *                      @OA\Property(property="id", type="integer", example="2", description="主键"),
     *                      @OA\Property(property="parentId", type="integer", example="1", description="上级ID"),
     *                      @OA\Property(property="name", type="string", example="叶百年", description="组织名称"),
     *                      @OA\Property(property="sort", type="integer", example="0", description="排序值"),
     *                  ),
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetInfo()
    {

    }
}
